<?php

namespace app\common\validate;

// 引入底层的验证器类
use think\validate;

// 管理员验证器
class Admin extends validate
{

    // 验证规则
    protected $rule = [
        //email字段，必须是必填、唯一的对照admin表
        'username' => 'require|unique:admin',
        'password' => 'require', //必填
        'salt' => 'require', //必填
        'nickname' => 'require', //必填
        'state' => 'number|in:0,1',  //给字段设置范围
    ];

    /* 提示消息*/
    protected $message = [
        'username.require' => '用户名必填',
        'username.unique' => '用户名已存在，请重新输入',
        'password.require'  => '密码必填',
        'nickname.require'  => '昵称必填',
        'salt.require'      => '密码盐必填',
        'state.number'    => '账号状态必须是个数字',
    ];

    // 验证场景
    protected $scene = [];
}
